package LeetCode.month02.day48;

import java.util.Arrays;
import java.util.Map;
import java.util.TreeMap;

public class No2327 {
    public static void main(String[] args) {
        System.out.println(peopleAwareOfSecret(6,2,4));
    }
    public static int peopleAwareOfSecret(int n, int delay, int forget) {
        int max = (int)1e9+7;
        long res = 0;
        int[] dp = new int[n+1];
        dp[1]=1;
        for (int i = 1; i <= n; i++) {
            if(i>=n-forget+1){
                res+=dp[i];
            }
            for (int j = i+delay; j <= Math.min(n,i+forget-1); j++) {
                dp[j]=(dp[j]+dp[i])%max;
            }
        }
        return (int)(res%max);
    }
}
